class Solution {//leetcode784——字母全排列
private:
    void _dfs(string& s,int pos){
        if(pos==s.size()){
            ret.push_back(path);
            return;
        }
        if(s[pos]>='a'&&s[pos]<='z'){
            path.push_back(s[pos]-'a'+'A');
            _dfs(s,pos+1);
            path.pop_back();
        }
        else if(s[pos]>='A'&&s[pos]<='Z'){
            path.push_back(s[pos]-'A'+'a');
            _dfs(s,pos+1);
            path.pop_back();
        }

        path.push_back(s[pos]);
        _dfs(s,pos+1);
        path.pop_back();
    }
public:
    vector<string> letterCasePermutation(string s) {
        _dfs(s,0);
        return ret;
    }
private:
    string path;
    vector<string> ret;
};